$(function(){
	var admin_id = getCookie('admin_id');
	if(!admin_id){
		window.location.replace('login.html');
	}
	 //业务开始
    var id = getQueryString('id');
    if(!id){
    	swal("操作错误", "参数传递错误！", "error");
    	setTimeout(function(){
             location.href="role.html";
		},3000);
		return false;
    }
	list_value(id);
});
function list_value(id){
		//获取店员列表
	    $.ajax({
			url: ApiUrl + "/shopping/"+id,
	        type: 'get',
	        dataType: 'JSON',
	        success: function(result) {
	        	if(result.code == 200){
	        		$("#out_trade_no").html(result.data.out_trade_no);
	        		$("#user_name").html(result.data.user_name);
	        		$("#trade_no").html(result.data.trade_no);
	        		$("#total_amount").html(result.data.total_amount);
	        		$("#auth_code").html(result.data.auth_code);
	        		$("#created_at").html(result.data.created_at);
	        		if(result.data.pay_type == 1){
	        			$("#pay_type").html("人民币");
                    }else if(result.data.pay_type == 2){
                    	$("#pay_type").html("银行卡");
                    }else if(result.data.pay_type == 3){
                    	$("#pay_type").html("积分兑换");
                    }else if(result.data.pay_type == 4){
                    	$("#pay_type").html("微信");
                    }else if(result.data.pay_type == 5){
                    	$("#pay_type").html( "支付宝");
                    }else if(result.data.pay_type == 6){
                    	$("#pay_type").html("会员卡");
                    }else if(result.data.pay_type == 7){
                    	$("#pay_type").html("礼券");
                    }
                    if(result.data.pay_status == 1){
                    	$("#pay_status").html("成功");
                    }else{
                    	$("#pay_status").html("失败");
                    }
                    var html='';
	        		$.each(result.data.detail, function(k, v) {
	        			html+='<tr>'
	                            +'<td>'+v.id+'</td>'
	                            +'<td>'+v.zh_name+'('+v.en_name+')</td>'
	                            +'<td>'+v.price+'</td>'
	                            +'<td>'+v.counts+'</td>'
	                            +'<td>'+v.created_at+'</td>';
	        		});
	        		$("#value").html(html);
	        	}else{
		    		parent.layer.msg(result.message);
		    		return false;
		    	}
	        }
	    });
}